package models;

import java.util.List;

public class Card {
	
	public enum Value  {
		ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, KNIGHT, QUEEN, KING
	};
	
	public enum Color {
		HEARTH, SPADE, DIAMOND, TREFLE, // TREFLE = ???? Shamrock ? 
		SANS_ATOUT, TOUT_ATOUT
	}
	public final Value value;
	public final Color color;
	
	public Card(Value value, Color color) {
		assert(color != Color.SANS_ATOUT && color != Color.TOUT_ATOUT);
		this.value = value;
		this.color = color;
	}

	@Override
	public boolean equals(Object arg0) {
		if (arg0 == null) {
			return false;
		} else if (arg0.getClass().getName() != Card.class.getName()) {
			return false;
		} else {
			Card c = (Card) arg0;
			return c.value == this.value && c.color == this.color;
		}
	}
	
	public boolean isHigherThan(Card c) {
		if (c == null) {
			return false;
		} else {
			int cardValue = c.value.ordinal();
			return this.value.ordinal() > cardValue;
		}
	}
	
	public boolean isBetterCardThan(Card c) {
		return false;
	}
	
	public boolean isBestCard(List<Card> cardList) {
		for (Card c : cardList) {
			if (c.isBetterCardThan(this)) {
				return false;
			}
		}
		return true;
	}
	
}
